package com.supermap.exception;

import com.alibaba.fastjson.JSONObject;
import com.supermap.protocol.RpcResponse;
import com.supermap.server.NettyServer;
import io.netty.channel.ChannelHandlerContext;

import static com.supermap.server.ServerHandler.saveErrorInfo;

/**
 * @author liqs
 * @version 1.0
 * @date 2021/4/7 14:49
 * 专门接收异常信息
 */
public class ServerException {

    public static String getException() {
        return exception;
    }

    public static void setException(String exception) {
        ServerException.exception = exception;
    }

    public static String exception;

    public static void sendException(ChannelHandlerContext ctx) {
        RpcResponse response = new RpcResponse();
        response.setError(ServerException.getException());
        response.setInfoPurposes("server.message");
        response.setStatus(-1);
        ctx.writeAndFlush(response);
    }
}
